//
//  M1DiagnosisViewController.m
//  NewMarryU
//
//  Created by apple on 2018/8/1.
//  Copyright © 2018年 Cedar. All rights reserved.
//

#import "M1DiagnosisViewController.h"
#import "M1QuestViewController.h"
@interface M1DiagnosisViewController ()

@end

@implementation M1DiagnosisViewController
-(UIStatusBarStyle)preferredStatusBarStyle{
    return UIStatusBarStyleLightContent;
}
-(void)m1_btnClick{
    if (![M1User user]) {
        WEAKSELF;
        [M1Alert m1_alertWithTitle:nil message:m1_loginText buttonTitles:@[@"取消",@"登录"] action:^(NSInteger index) {
            if (index == 1) {
                M1LoginVC *m1_loginVC = [M1LoginVC new];
                m1_loginVC.m1_changeBackImage = YES;
                m1_loginVC.m1_changeNavTitleColor = YES;
                m1_loginVC.hidesBottomBarWhenPushed = YES;
                [weakSelf.navigationController pushViewController:m1_loginVC animated:YES];
            }
        }];
        return;
    }
    
    M1QuestViewController *m1_VC = [M1QuestViewController new];
    m1_VC.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:m1_VC animated:YES];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    UIScrollView *m1_scroll = [[UIScrollView alloc]init];
    [self.view addSubview:m1_scroll];
    if (@available(iOS 11.0, *)) {
        m1_scroll.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    }
    [m1_scroll mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_offset(UIEdgeInsetsMake(0, 0, 0, 0));
    }];
    
    UIImageView *img1 = [[UIImageView alloc]init];
    img1.image = [UIImage imageNamed:@"pic_1"];
    [m1_scroll addSubview:img1];
    
    [img1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.offset(0);
        make.left.equalTo(self.view.mas_left);
        make.right.equalTo(self.view.mas_right);
    }];
    
    UIView *m1_view = [[UIView alloc]init];
    m1_view.backgroundColor = [UIColor whiteColor];
    [m1_scroll addSubview:m1_view];
    
    [m1_view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view.mas_left);
        make.right.equalTo(self.view.mas_right);
        make.top.equalTo(img1.mas_bottom);
        make.height.mas_offset(142);
    }];
    
    UIButton *m1_btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [m1_btn setImage:[UIImage imageNamed:@"pic_2"] forState:0];
    [m1_btn setImage:[UIImage imageNamed:@"pic_2"] forState:1];
    [m1_view addSubview:m1_btn];
    [m1_btn addTarget:self action:@selector(m1_btnClick) forControlEvents:UIControlEventTouchUpInside];
    [m1_btn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(m1_view.mas_centerX);
        make.top.offset(20);
    }];
    
    UILabel *m1_LB = [[UILabel alloc]init];
    m1_LB.font = m1_font(13);
    m1_LB.text = @"——————— 累计预约人数 ——————";
    m1_LB.textColor = [UIColor m1_colorHex:0x666666];
    [m1_view addSubview:m1_LB];
    
    [m1_LB mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(m1_view.mas_centerX);
        make.top.equalTo(m1_btn.mas_bottom).offset(14);
    }];
    
    for (int i = 0; i<4; i++) {
        UILabel *m1_LB1 = [[UILabel alloc]init];
        m1_LB1.font = m1_font(13);
        m1_LB1.textAlignment = NSTextAlignmentCenter;
        m1_LB1.text = i==2?@"0":(i==3?@"3":@"1");
        m1_LB1.textColor = [UIColor m1_colorHex:0x333333];
        m1_LB1.backgroundColor = [UIColor m1_colorHex:0xF8D28B];
        [m1_view addSubview:m1_LB1];
        
        if (i<2) {
            [m1_LB1 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.right.equalTo(m1_view.mas_centerX).offset(-1.5-24*i);
                make.top.equalTo(m1_LB.mas_bottom).offset(10);
                make.size.mas_offset(CGSizeMake(21, 21));
            }];
        }else{
            [m1_LB1 mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.equalTo(m1_view.mas_centerX).offset(1.5+24*(i-2));
                make.top.equalTo(m1_LB.mas_bottom).offset(10);
                make.size.mas_offset(CGSizeMake(21, 21));
            }];
        }
        
    }
    
    UIImageView *img2 = [[UIImageView alloc]init];
    img2.image = [UIImage imageNamed:@"pic_3"];
    [m1_scroll addSubview:img2];
    
    [img2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(m1_view.mas_bottom);
        make.left.equalTo(self.view.mas_left);
        make.right.equalTo(self.view.mas_right);
        make.bottom.equalTo(m1_scroll.mas_bottom);
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
